package cn.gson.tj_springboot.controler.AfterController;


import cn.gson.tj_springboot.model.pojos.ProblemTable;
import cn.gson.tj_springboot.model.service.AfterSalesService.ProblemBaseService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
public class ProblemBaseController {
    @Autowired
        ProblemBaseService ps;
    @RequestMapping("/problembase")
    @ResponseBody
    public Map<String,Object> problemList(Integer page, Integer size){
        Page<Object> obj = PageHelper.startPage(page,size);
        List<Map<String,Object>> maps = ps.findAllProblem();
        Map<String,Object> map = new HashMap<>();
        map.put("total",obj.getTotal());
        map.put("rows",maps);

        return map;
    }
}
